home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 2
/
Amiga Tools 2.iso
/
net
/
parnet-3.2
/
extras
/
parpc
/
amigafiles
/
sources
/
unit_ctl.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-09
|
1KB
|
87 lines
/*
* UNIT_CTL.C
*
* Control Unit. Used for global control, sink null as far as
* read & write goes.
*/
#include "defs.h"
void CtlAbortIO(Iob *);
void CtlClose(Iob *);
void CtlData(int, Unit *, Packet *);
void UnitControlOpen(Iob *, long, long);
static short CtlRefs = 0;
void
UnitControlOpen(iob, unitnum, flags)
Iob *iob;
long unitnum;
long flags;
{
Unit *unit = AllocUnit(iob, CtlBeginIO, CtlAbortIO, CtlData, CtlClose);
++CtlRefs;
iob->io_Unit = unit;
iob->io_Port = 0;
iob->io_Addr = 0;
}
void
CtlData(cmd, unit, packet)
int cmd;
Unit *unit;
Packet *packet;
{
FreeParPacket(packet);
}
void
CtlClose(iob)
Iob *iob;
{
FreeUnit(iob->io_Unit);
--CtlRefs;
iob->io_Unit = NULL;
}
void
CtlBeginIO(iob)
Iob *iob;
{
iob->io_Error = 0;
iob->io_Actual = 0;
iob->io_Message.mn_Node.ln_Type = NT_MESSAGE;
switch(iob->io_Command) {
case PPD_SETADDR: /* set network address */
ParAddress(iob->io_Addr);
DevBase->ParAddress = iob->io_Addr;
WriteConfig();
break;
case PPD_SETTO: /* set network timeout */
ParLLTimeout = iob->io_Offset;
WriteConfig();
break;
default:
iob->io_Error = IOERR_NOCMD;
break;
}
if ((iob->io_Flags & IOF_QUICK) == 0)
ReplyMsg(&iob->io_Message);
}
void
CtlAbortIO(iob)
Iob *iob;
{
}